package com.zhanghp.demo01.generic.lab01;

import com.zhanghp.demo01.ActionType;
import com.zhanghp.demo01.generic.fundament.Publisher;
import lombok.extern.slf4j.Slf4j;

/**
 * @author zhanghp
 * @date 2022-08-26 14:46
 */
@Slf4j
public class GChild extends Publisher<Care, ActionType> {

    private ActionType actionType;

    public GChild() {
        actionType = ActionType.SLEEPING;
    }

    public void changeAction(){
        var enums = ActionType.values();
        actionType = enums[(actionType.ordinal() + 1) % enums.length];
        log.info("the child action is changed to {}", actionType);
        notifyObservers(actionType);
    }
}
